﻿using System;

namespace Eneta.Portal.Forum.Rss
{
    [Serializable]
    public class RssItem : RssElement
    {
        // Fields
        private string author = "";
        private RssCategoryCollection categories = new RssCategoryCollection();
        private string comments = "";
        private string description = "";
        private RssEnclosure enclosure = null;
        private RssGuid guid = null;
        private Uri link = RssDefault.Uri;
        private DateTime pubDate = RssDefault.DateTime;
        private RssSource source = null;
        private string title = "";

        // Methods
        public override string ToString()
        {
            if (this.title != null)
            {
                return this.title;
            }
            if (this.description != null)
            {
                return this.description;
            }
            return "RssItem";
        }

        // Properties
        public string Author
        {
            get
            {
                return this.author;
            }
            set
            {
                this.author = RssDefault.Check(value);
            }
        }

        public RssCategoryCollection Categories
        {
            get
            {
                return this.categories;
            }
        }

        public string Comments
        {
            get
            {
                return this.comments;
            }
            set
            {
                this.comments = RssDefault.Check(value);
            }
        }

        public string Description
        {
            get
            {
                return this.description;
            }
            set
            {
                this.description = RssDefault.Check(value);
            }
        }

        public RssEnclosure Enclosure
        {
            get
            {
                return this.enclosure;
            }
            set
            {
                this.enclosure = value;
            }
        }

        public RssGuid Guid
        {
            get
            {
                return this.guid;
            }
            set
            {
                this.guid = value;
            }
        }

        public Uri Link
        {
            get
            {
                return this.link;
            }
            set
            {
                this.link = RssDefault.Check(value);
            }
        }

        public DateTime PubDate
        {
            get
            {
                return this.pubDate;
            }
            set
            {
                this.pubDate = value;
            }
        }

        public RssSource Source
        {
            get
            {
                return this.source;
            }
            set
            {
                this.source = value;
            }
        }

        public string Title
        {
            get
            {
                return this.title;
            }
            set
            {
                this.title = RssDefault.Check(value);
            }
        }
    }
}
